<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Doxygen: pcl::NNClassification&lt; PointT &gt; 模板类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Doxygen
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'搜索','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classpcl_1_1_n_n_classification.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-types">Public 类型</a> &#124;
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#pri-attribs">Private 属性</a> &#124;
<a href="classpcl_1_1_n_n_classification-members.html">所有成员列表</a>  </div>
  <div class="headertitle">
<div class="title">pcl::NNClassification&lt; PointT &gt; 模板类 参考</div>  </div>
</div><!--header-->
<div class="contents">

<p>Nearest neighbor search based classification of PCL point type features. FLANN is used to identify a neighborhood, based on which different scoring schemes can be employed to obtain likelihood values for a specified list of classes.  
 <a href="classpcl_1_1_n_n_classification.html#details">更多...</a></p>

<p><code>#include &lt;<a class="el" href="nn__classification_8h_source.html">nn_classification.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public 类型</h2></td></tr>
<tr class="memitem:a3ee26d1c66443ab14e484d591969b8a0"><td class="memItemLeft" align="right" valign="top"><a id="a3ee26d1c66443ab14e484d591969b8a0"></a>
typedef std::pair&lt; std::vector&lt; std::string &gt;, std::vector&lt; float &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1_n_n_classification.html#a3ee26d1c66443ab14e484d591969b8a0">Result</a></td></tr>
<tr class="memdesc:a3ee26d1c66443ab14e484d591969b8a0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Result is a list of class labels and scores <br /></td></tr>
<tr class="separator:a3ee26d1c66443ab14e484d591969b8a0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a575c10ba3aed17c11d952c64b9875953"><td class="memItemLeft" align="right" valign="top"><a id="a575c10ba3aed17c11d952c64b9875953"></a>
typedef boost::shared_ptr&lt; <a class="el" href="classpcl_1_1_n_n_classification.html#a3ee26d1c66443ab14e484d591969b8a0">Result</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>ResultPtr</b></td></tr>
<tr class="separator:a575c10ba3aed17c11d952c64b9875953"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a52bec8579465e01bf4ed1ed9667c69bb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1_n_n_classification.html#a52bec8579465e01bf4ed1ed9667c69bb">setTrainingFeatures</a> (const typename <a class="el" href="classpcl_1_1_point_cloud.html">pcl::PointCloud</a>&lt; <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &gt;::ConstPtr &amp;features)</td></tr>
<tr class="memdesc:a52bec8579465e01bf4ed1ed9667c69bb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Setting the training features.  <a href="classpcl_1_1_n_n_classification.html#a52bec8579465e01bf4ed1ed9667c69bb">更多...</a><br /></td></tr>
<tr class="separator:a52bec8579465e01bf4ed1ed9667c69bb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7c06ebf50123854d0a4712654a944f23"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1_n_n_classification.html#a7c06ebf50123854d0a4712654a944f23">setTrainingLabelIndicesAndLUT</a> (const std::vector&lt; std::string &gt; &amp;classes, const std::vector&lt; int &gt; &amp;labels_idx)</td></tr>
<tr class="memdesc:a7c06ebf50123854d0a4712654a944f23"><td class="mdescLeft">&#160;</td><td class="mdescRight">Updating the labels for each training example.  <a href="classpcl_1_1_n_n_classification.html#a7c06ebf50123854d0a4712654a944f23">更多...</a><br /></td></tr>
<tr class="separator:a7c06ebf50123854d0a4712654a944f23"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a240a675d7ba75bbc77482ed7accc7ce0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1_n_n_classification.html#a240a675d7ba75bbc77482ed7accc7ce0">setTrainingLabels</a> (const std::vector&lt; std::string &gt; &amp;labels)</td></tr>
<tr class="memdesc:a240a675d7ba75bbc77482ed7accc7ce0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Setting the labels for each training example. The unique labels from the list are stored as the class labels, and for each training example an index pointing to these labels is stored.  <a href="classpcl_1_1_n_n_classification.html#a240a675d7ba75bbc77482ed7accc7ce0">更多...</a><br /></td></tr>
<tr class="separator:a240a675d7ba75bbc77482ed7accc7ce0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a39d8fcd0b119124f37578e58698780ea"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1_n_n_classification.html#a39d8fcd0b119124f37578e58698780ea">loadTrainingFeatures</a> (std::string file_name, std::string labels_file_name)</td></tr>
<tr class="memdesc:a39d8fcd0b119124f37578e58698780ea"><td class="mdescLeft">&#160;</td><td class="mdescRight">Load the list of training examples and corresponding labels.  <a href="classpcl_1_1_n_n_classification.html#a39d8fcd0b119124f37578e58698780ea">更多...</a><br /></td></tr>
<tr class="separator:a39d8fcd0b119124f37578e58698780ea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7c8be2d8883ec49769ac31e5756ef701"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1_n_n_classification.html#a7c8be2d8883ec49769ac31e5756ef701">saveTrainingFeatures</a> (std::string file_name, std::string labels_file_name)</td></tr>
<tr class="memdesc:a7c8be2d8883ec49769ac31e5756ef701"><td class="mdescLeft">&#160;</td><td class="mdescRight">Save the list of training examples and corresponding labels.  <a href="classpcl_1_1_n_n_classification.html#a7c8be2d8883ec49769ac31e5756ef701">更多...</a><br /></td></tr>
<tr class="separator:a7c8be2d8883ec49769ac31e5756ef701"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad0a5ee6bfd2250845459c03bd542fa74"><td class="memItemLeft" align="right" valign="top">ResultPtr&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1_n_n_classification.html#ad0a5ee6bfd2250845459c03bd542fa74">classify</a> (const <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &amp;p_q, double radius, float gaussian_param, int max_nn=INT_MAX)</td></tr>
<tr class="memdesc:ad0a5ee6bfd2250845459c03bd542fa74"><td class="mdescLeft">&#160;</td><td class="mdescRight">Utility function for the default classification process.  <a href="classpcl_1_1_n_n_classification.html#ad0a5ee6bfd2250845459c03bd542fa74">更多...</a><br /></td></tr>
<tr class="separator:ad0a5ee6bfd2250845459c03bd542fa74"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad65343adb76d5dada80d92daf31811ac"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1_n_n_classification.html#ad65343adb76d5dada80d92daf31811ac">getKNearestExemplars</a> (const <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &amp;p_q, int k, std::vector&lt; int &gt; &amp;k_indices, std::vector&lt; float &gt; &amp;k_sqr_distances)</td></tr>
<tr class="memdesc:ad65343adb76d5dada80d92daf31811ac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Search for k-nearest neighbors for the given query point.  <a href="classpcl_1_1_n_n_classification.html#ad65343adb76d5dada80d92daf31811ac">更多...</a><br /></td></tr>
<tr class="separator:ad65343adb76d5dada80d92daf31811ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3e791bb176825ee2a2e2890efca4505b"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1_n_n_classification.html#a3e791bb176825ee2a2e2890efca4505b">getSimilarExemplars</a> (const <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &amp;p_q, double radius, std::vector&lt; int &gt; &amp;k_indices, std::vector&lt; float &gt; &amp;k_sqr_distances, int max_nn=INT_MAX)</td></tr>
<tr class="memdesc:a3e791bb176825ee2a2e2890efca4505b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Search for all the nearest neighbors of the query point in a given radius.  <a href="classpcl_1_1_n_n_classification.html#a3e791bb176825ee2a2e2890efca4505b">更多...</a><br /></td></tr>
<tr class="separator:a3e791bb176825ee2a2e2890efca4505b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa89d07e6c77bfc5667fadcac1c6a68b8"><td class="memItemLeft" align="right" valign="top">boost::shared_ptr&lt; std::vector&lt; float &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1_n_n_classification.html#aa89d07e6c77bfc5667fadcac1c6a68b8">getSmallestSquaredDistances</a> (std::vector&lt; int &gt; &amp;k_indices, std::vector&lt; float &gt; &amp;k_sqr_distances)</td></tr>
<tr class="memdesc:aa89d07e6c77bfc5667fadcac1c6a68b8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the smallest square distance to each class given a neighborhood.  <a href="classpcl_1_1_n_n_classification.html#aa89d07e6c77bfc5667fadcac1c6a68b8">更多...</a><br /></td></tr>
<tr class="separator:aa89d07e6c77bfc5667fadcac1c6a68b8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:add1e1efa2c94d209c7800694045001e9"><td class="memItemLeft" align="right" valign="top">ResultPtr&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1_n_n_classification.html#add1e1efa2c94d209c7800694045001e9">getLinearBestScores</a> (std::vector&lt; int &gt; &amp;k_indices, std::vector&lt; float &gt; &amp;k_sqr_distances)</td></tr>
<tr class="memdesc:add1e1efa2c94d209c7800694045001e9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes a score that is inversely proportional to the distance to each class given a neighborhood.  <a href="classpcl_1_1_n_n_classification.html#add1e1efa2c94d209c7800694045001e9">更多...</a><br /></td></tr>
<tr class="separator:add1e1efa2c94d209c7800694045001e9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a703c1ed4ec46fc697ec076d78a15d2aa"><td class="memItemLeft" align="right" valign="top">ResultPtr&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1_n_n_classification.html#a703c1ed4ec46fc697ec076d78a15d2aa">getGaussianBestScores</a> (float gaussian_param, std::vector&lt; int &gt; &amp;k_indices, std::vector&lt; float &gt; &amp;k_sqr_distances)</td></tr>
<tr class="memdesc:a703c1ed4ec46fc697ec076d78a15d2aa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes a score exponentially decreasing with the distance for each class given a neighborhood.  <a href="classpcl_1_1_n_n_classification.html#a703c1ed4ec46fc697ec076d78a15d2aa">更多...</a><br /></td></tr>
<tr class="separator:a703c1ed4ec46fc697ec076d78a15d2aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pri-attribs"></a>
Private 属性</h2></td></tr>
<tr class="memitem:a787ee86c16348da48324f3e1f8157940"><td class="memItemLeft" align="right" valign="top"><a id="a787ee86c16348da48324f3e1f8157940"></a>
<a class="el" href="classpcl_1_1_kd_tree.html">pcl::KdTree</a>&lt; <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &gt;::Ptr&#160;</td><td class="memItemRight" valign="bottom"><b>tree_</b></td></tr>
<tr class="separator:a787ee86c16348da48324f3e1f8157940"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aedeacc2a645a022a4306395a10c1cbfa"><td class="memItemLeft" align="right" valign="top"><a id="aedeacc2a645a022a4306395a10c1cbfa"></a>
std::vector&lt; std::string &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a></td></tr>
<tr class="memdesc:aedeacc2a645a022a4306395a10c1cbfa"><td class="mdescLeft">&#160;</td><td class="mdescRight">List of class labels <br /></td></tr>
<tr class="separator:aedeacc2a645a022a4306395a10c1cbfa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aac238edad83e267297c2281dbad39d3a"><td class="memItemLeft" align="right" valign="top"><a id="aac238edad83e267297c2281dbad39d3a"></a>
std::vector&lt; int &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">labels_idx_</a></td></tr>
<tr class="memdesc:aac238edad83e267297c2281dbad39d3a"><td class="mdescLeft">&#160;</td><td class="mdescRight">The index in the class labels list for all the training examples <br /></td></tr>
<tr class="separator:aac238edad83e267297c2281dbad39d3a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><h3>template&lt;typename PointT&gt;<br />
class pcl::NNClassification&lt; PointT &gt;</h3>

<p>Nearest neighbor search based classification of PCL point type features. FLANN is used to identify a neighborhood, based on which different scoring schemes can be employed to obtain likelihood values for a specified list of classes. </p>
<dl class="section author"><dt>作者</dt><dd>Zoltan Csaba Marton </dd></dl>
</div><h2 class="groupheader">成员函数说明</h2>
<a id="ad0a5ee6bfd2250845459c03bd542fa74"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad0a5ee6bfd2250845459c03bd542fa74">&#9670;&nbsp;</a></span>classify()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename PointT &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">ResultPtr <a class="el" href="classpcl_1_1_n_n_classification.html">pcl::NNClassification</a>&lt; <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &gt;::classify </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &amp;&#160;</td>
          <td class="paramname"><em>p_q</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>radius</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>gaussian_param</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>max_nn</em> = <code>INT_MAX</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Utility function for the default classification process. </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">p_q</td><td>the given query point </td></tr>
    <tr><td class="paramname">radius</td><td>the radius of the sphere bounding all of p_q's neighbors </td></tr>
    <tr><td class="paramname">gaussian_param</td><td>influences the width of the Gaussian by specifying where the 36.78 score should be: score = exp(-distance/gaussian_param) </td></tr>
    <tr><td class="paramname">max_nn</td><td>if given, bounds the maximum returned neighbors to this value </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>pair of label and score for each training class from the neighborhood </dd></dl>
<div class="fragment"><div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;      {</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;        std::vector&lt;int&gt; k_indices;</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;        std::vector&lt;float&gt; k_sqr_distances;</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;        <a class="code" href="classpcl_1_1_n_n_classification.html#a3e791bb176825ee2a2e2890efca4505b">getSimilarExemplars</a> (p_q, radius, k_indices, k_sqr_distances, max_nn);</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;        <span class="keywordflow">return</span> (<a class="code" href="classpcl_1_1_n_n_classification.html#a703c1ed4ec46fc697ec076d78a15d2aa">getGaussianBestScores</a> (gaussian_param, k_indices, k_sqr_distances));</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;      }</div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_a3e791bb176825ee2a2e2890efca4505b"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#a3e791bb176825ee2a2e2890efca4505b">pcl::NNClassification::getSimilarExemplars</a></div><div class="ttdeci">int getSimilarExemplars(const PointT &amp;p_q, double radius, std::vector&lt; int &gt; &amp;k_indices, std::vector&lt; float &gt; &amp;k_sqr_distances, int max_nn=INT_MAX)</div><div class="ttdoc">Search for all the nearest neighbors of the query point in a given radius.</div><div class="ttdef"><b>Definition:</b> nn_classification.h:218</div></div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_a703c1ed4ec46fc697ec076d78a15d2aa"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#a703c1ed4ec46fc697ec076d78a15d2aa">pcl::NNClassification::getGaussianBestScores</a></div><div class="ttdeci">ResultPtr getGaussianBestScores(float gaussian_param, std::vector&lt; int &gt; &amp;k_indices, std::vector&lt; float &gt; &amp;k_sqr_distances)</div><div class="ttdoc">Computes a score exponentially decreasing with the distance for each class given a neighborhood.</div><div class="ttdef"><b>Definition:</b> nn_classification.h:280</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="a703c1ed4ec46fc697ec076d78a15d2aa"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a703c1ed4ec46fc697ec076d78a15d2aa">&#9670;&nbsp;</a></span>getGaussianBestScores()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename PointT &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">ResultPtr <a class="el" href="classpcl_1_1_n_n_classification.html">pcl::NNClassification</a>&lt; <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &gt;::getGaussianBestScores </td>
          <td>(</td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>gaussian_param</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::vector&lt; int &gt; &amp;&#160;</td>
          <td class="paramname"><em>k_indices</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::vector&lt; float &gt; &amp;&#160;</td>
          <td class="paramname"><em>k_sqr_distances</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Computes a score exponentially decreasing with the distance for each class given a neighborhood. </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">gaussian_param</td><td>influences the width of the Gaussian: score = exp(-distance/gaussioan_param) </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">k_indices</td><td>the resultant indices of the neighboring points </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">k_sqr_distances</td><td>the resultant squared distances to the neighboring points </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>pair of label and score for each training class from the neighborhood </dd></dl>
<div class="fragment"><div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;      {</div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;        <span class="comment">// Get smallest squared distances and transform them to a score for each class</span></div>
<div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;        boost::shared_ptr&lt;std::vector&lt;float&gt; &gt; sqr_distances = <a class="code" href="classpcl_1_1_n_n_classification.html#aa89d07e6c77bfc5667fadcac1c6a68b8">getSmallestSquaredDistances</a> (k_indices, k_sqr_distances);</div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160; </div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;        <span class="comment">// Transform distances to scores</span></div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;        boost::shared_ptr&lt;std::pair&lt;std::vector&lt;std::string&gt;, std::vector&lt;float&gt; &gt; &gt; result (<span class="keyword">new</span> std::pair&lt;std::vector&lt;std::string&gt;, std::vector&lt;float&gt; &gt; ());</div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;        result-&gt;first.reserve (<a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.size ());</div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;        result-&gt;second.reserve (<a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.size ());</div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;        <span class="keywordflow">for</span> (std::vector&lt;float&gt;::const_iterator it = sqr_distances-&gt;begin (); it != sqr_distances-&gt;end (); ++it)</div>
<div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;          <span class="keywordflow">if</span> (*it != FLT_MAX)</div>
<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;          {</div>
<div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;            result-&gt;first.push_back (<a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>[it - sqr_distances-&gt;begin ()]);</div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;            <span class="comment">// TODO leave it squared, and relate param to sigma...</span></div>
<div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;            result-&gt;second.push_back (expf (-std::sqrt (*it) / gaussian_param));</div>
<div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;          }</div>
<div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160; </div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;        <span class="comment">// Return label/score list pair</span></div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;        <span class="keywordflow">return</span> (result);</div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;      }</div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_aa89d07e6c77bfc5667fadcac1c6a68b8"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#aa89d07e6c77bfc5667fadcac1c6a68b8">pcl::NNClassification::getSmallestSquaredDistances</a></div><div class="ttdeci">boost::shared_ptr&lt; std::vector&lt; float &gt; &gt; getSmallestSquaredDistances(std::vector&lt; int &gt; &amp;k_indices, std::vector&lt; float &gt; &amp;k_sqr_distances)</div><div class="ttdoc">Gets the smallest square distance to each class given a neighborhood.</div><div class="ttdef"><b>Definition:</b> nn_classification.h:230</div></div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_aedeacc2a645a022a4306395a10c1cbfa"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">pcl::NNClassification::classes_</a></div><div class="ttdeci">std::vector&lt; std::string &gt; classes_</div><div class="ttdoc">List of class labels</div><div class="ttdef"><b>Definition:</b> nn_classification.h:66</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="ad65343adb76d5dada80d92daf31811ac"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad65343adb76d5dada80d92daf31811ac">&#9670;&nbsp;</a></span>getKNearestExemplars()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename PointT &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="classpcl_1_1_n_n_classification.html">pcl::NNClassification</a>&lt; <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &gt;::getKNearestExemplars </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &amp;&#160;</td>
          <td class="paramname"><em>p_q</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>k</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::vector&lt; int &gt; &amp;&#160;</td>
          <td class="paramname"><em>k_indices</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::vector&lt; float &gt; &amp;&#160;</td>
          <td class="paramname"><em>k_sqr_distances</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Search for k-nearest neighbors for the given query point. </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">p_q</td><td>the given query point </td></tr>
    <tr><td class="paramname">k</td><td>the number of neighbors to search for </td></tr>
    <tr><td class="paramname">k_indices</td><td>the resultant indices of the neighboring points (does not have to be resized to <em>k</em> a priori!) </td></tr>
    <tr><td class="paramname">k_sqr_distances</td><td>the resultant squared distances to the neighboring points (does not have be resized to <em>k</em> a priori!) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>number of neighbors found </dd></dl>
<div class="fragment"><div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;      {</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;        k_indices.resize (k);</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;        k_sqr_distances.resize (k);</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;        <span class="keywordflow">return</span> (tree_-&gt;nearestKSearch (p_q, k, k_indices, k_sqr_distances));</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;      }</div>
</div><!-- fragment -->
</div>
</div>
<a id="add1e1efa2c94d209c7800694045001e9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#add1e1efa2c94d209c7800694045001e9">&#9670;&nbsp;</a></span>getLinearBestScores()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename PointT &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">ResultPtr <a class="el" href="classpcl_1_1_n_n_classification.html">pcl::NNClassification</a>&lt; <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &gt;::getLinearBestScores </td>
          <td>(</td>
          <td class="paramtype">std::vector&lt; int &gt; &amp;&#160;</td>
          <td class="paramname"><em>k_indices</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::vector&lt; float &gt; &amp;&#160;</td>
          <td class="paramname"><em>k_sqr_distances</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Computes a score that is inversely proportional to the distance to each class given a neighborhood. </p>
<dl class="section note"><dt>注解</dt><dd>Scores will sum up to one. </dd></dl>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">k_indices</td><td>the resultant indices of the neighboring points </td></tr>
    <tr><td class="paramname">k_sqr_distances</td><td>the resultant squared distances to the neighboring points </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>pair of label and score for each training class from the neighborhood </dd></dl>
<div class="fragment"><div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;      {</div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;        <span class="comment">// Get smallest squared distances and transform them to a score for each class</span></div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;        boost::shared_ptr&lt;std::vector&lt;float&gt; &gt; sqr_distances = <a class="code" href="classpcl_1_1_n_n_classification.html#aa89d07e6c77bfc5667fadcac1c6a68b8">getSmallestSquaredDistances</a> (k_indices, k_sqr_distances);</div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160; </div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;        <span class="comment">// Transform distances to scores</span></div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;        <span class="keywordtype">double</span> sum_dist = 0;</div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;        boost::shared_ptr&lt;std::pair&lt;std::vector&lt;std::string&gt;, std::vector&lt;float&gt; &gt; &gt; result (<span class="keyword">new</span> std::pair&lt;std::vector&lt;std::string&gt;, std::vector&lt;float&gt; &gt; ());</div>
<div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;        result-&gt;first.reserve (<a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.size ());</div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;        result-&gt;second.reserve (<a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.size ());</div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;        <span class="keywordflow">for</span> (std::vector&lt;float&gt;::const_iterator it = sqr_distances-&gt;begin (); it != sqr_distances-&gt;end (); ++it)</div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;          <span class="keywordflow">if</span> (*it != FLT_MAX)</div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;          {</div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;            result-&gt;first.push_back (<a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>[it - sqr_distances-&gt;begin ()]);</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;            result-&gt;second.push_back (sqrt (*it));</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;            sum_dist += result-&gt;second.back ();</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;          }</div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;        <span class="keywordflow">for</span> (std::vector&lt;float&gt;::iterator it = result-&gt;second.begin (); it != result-&gt;second.end (); ++it)</div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;          *it = 1 - *it/sum_dist;</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160; </div>
<div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;        <span class="comment">// Return label/score list pair</span></div>
<div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;        <span class="keywordflow">return</span> (result);</div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;      }</div>
</div><!-- fragment -->
</div>
</div>
<a id="a3e791bb176825ee2a2e2890efca4505b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3e791bb176825ee2a2e2890efca4505b">&#9670;&nbsp;</a></span>getSimilarExemplars()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename PointT &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="classpcl_1_1_n_n_classification.html">pcl::NNClassification</a>&lt; <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &gt;::getSimilarExemplars </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &amp;&#160;</td>
          <td class="paramname"><em>p_q</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>radius</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::vector&lt; int &gt; &amp;&#160;</td>
          <td class="paramname"><em>k_indices</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::vector&lt; float &gt; &amp;&#160;</td>
          <td class="paramname"><em>k_sqr_distances</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>max_nn</em> = <code>INT_MAX</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Search for all the nearest neighbors of the query point in a given radius. </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">p_q</td><td>the given query point </td></tr>
    <tr><td class="paramname">radius</td><td>the radius of the sphere bounding all of p_q's neighbors </td></tr>
    <tr><td class="paramname">k_indices</td><td>the resultant indices of the neighboring points </td></tr>
    <tr><td class="paramname">k_sqr_distances</td><td>the resultant squared distances to the neighboring points </td></tr>
    <tr><td class="paramname">max_nn</td><td>if given, bounds the maximum returned neighbors to this value </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>number of neighbors found in radius </dd></dl>
<div class="fragment"><div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;      {</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;        <span class="keywordflow">return</span> (tree_-&gt;radiusSearch (p_q, radius, k_indices, k_sqr_distances, max_nn));</div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;      }</div>
</div><!-- fragment -->
</div>
</div>
<a id="aa89d07e6c77bfc5667fadcac1c6a68b8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa89d07e6c77bfc5667fadcac1c6a68b8">&#9670;&nbsp;</a></span>getSmallestSquaredDistances()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename PointT &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">boost::shared_ptr&lt;std::vector&lt;float&gt; &gt; <a class="el" href="classpcl_1_1_n_n_classification.html">pcl::NNClassification</a>&lt; <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &gt;::getSmallestSquaredDistances </td>
          <td>(</td>
          <td class="paramtype">std::vector&lt; int &gt; &amp;&#160;</td>
          <td class="paramname"><em>k_indices</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::vector&lt; float &gt; &amp;&#160;</td>
          <td class="paramname"><em>k_sqr_distances</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Gets the smallest square distance to each class given a neighborhood. </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">k_indices</td><td>the resultant indices of the neighboring points </td></tr>
    <tr><td class="paramname">k_sqr_distances</td><td>the resultant squared distances to the neighboring points </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>a square distance to each training class </dd></dl>
<div class="fragment"><div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;      {</div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;        <span class="comment">// Reserve space for distances</span></div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;        boost::shared_ptr&lt;std::vector&lt;float&gt; &gt; sqr_distances (<span class="keyword">new</span> std::vector&lt;float&gt; (<a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.size (), FLT_MAX));</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160; </div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;        <span class="comment">// Select square distance to each class</span></div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;        <span class="keywordflow">for</span> (std::vector&lt;int&gt;::const_iterator i = k_indices.begin (); i != k_indices.end (); ++i)</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;          <span class="keywordflow">if</span> ((*sqr_distances)[<a class="code" href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">labels_idx_</a>[*i]] &gt; k_sqr_distances[i - k_indices.begin ()])</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;            (*sqr_distances)[<a class="code" href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">labels_idx_</a>[*i]] = k_sqr_distances[i - k_indices.begin ()];</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;        <span class="keywordflow">return</span> (sqr_distances);</div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;      }</div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_aac238edad83e267297c2281dbad39d3a"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">pcl::NNClassification::labels_idx_</a></div><div class="ttdeci">std::vector&lt; int &gt; labels_idx_</div><div class="ttdoc">The index in the class labels list for all the training examples</div><div class="ttdef"><b>Definition:</b> nn_classification.h:68</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="a39d8fcd0b119124f37578e58698780ea"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a39d8fcd0b119124f37578e58698780ea">&#9670;&nbsp;</a></span>loadTrainingFeatures()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename PointT &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool <a class="el" href="classpcl_1_1_n_n_classification.html">pcl::NNClassification</a>&lt; <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &gt;::loadTrainingFeatures </td>
          <td>(</td>
          <td class="paramtype">std::string&#160;</td>
          <td class="paramname"><em>file_name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::string&#160;</td>
          <td class="paramname"><em>labels_file_name</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Load the list of training examples and corresponding labels. </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">file_name</td><td>PCD file containing the training features </td></tr>
    <tr><td class="paramname">labels_file_name</td><td>the class label for each training example </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>true on success, false on failure (read error or number of entries don't match) </dd></dl>
<div class="fragment"><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;      {</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;        <span class="keyword">typename</span> pcl::PointCloud&lt;PointT&gt;::Ptr cloud (<span class="keyword">new</span> <a class="code" href="classpcl_1_1_point_cloud.html">pcl::PointCloud&lt;PointT&gt;</a>);</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;        <span class="keywordflow">if</span> (pcl::io::loadPCDFile (file_name.c_str (), *cloud) != 0)</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;          <span class="keywordflow">return</span> (<span class="keyword">false</span>);</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;        std::vector&lt;std::string&gt; labels;</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;        std::ifstream f (labels_file_name.c_str ());</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;        std::string label;</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;        <span class="keywordflow">while</span> (getline (f, label))</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;          <span class="keywordflow">if</span> (label.size () &gt; 0)</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;            labels.push_back(label);</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;        <span class="keywordflow">if</span> (labels.size () != cloud-&gt;points.size ())</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;          <span class="keywordflow">return</span> (<span class="keyword">false</span>);</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;        <a class="code" href="classpcl_1_1_n_n_classification.html#a52bec8579465e01bf4ed1ed9667c69bb">setTrainingFeatures</a> (cloud);</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;        <a class="code" href="classpcl_1_1_n_n_classification.html#a240a675d7ba75bbc77482ed7accc7ce0">setTrainingLabels</a> (labels);</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;        <span class="keywordflow">return</span> (<span class="keyword">true</span>);</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;      }</div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_a240a675d7ba75bbc77482ed7accc7ce0"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#a240a675d7ba75bbc77482ed7accc7ce0">pcl::NNClassification::setTrainingLabels</a></div><div class="ttdeci">void setTrainingLabels(const std::vector&lt; std::string &gt; &amp;labels)</div><div class="ttdoc">Setting the labels for each training example. The unique labels from the list are stored as the class...</div><div class="ttdef"><b>Definition:</b> nn_classification.h:112</div></div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_a52bec8579465e01bf4ed1ed9667c69bb"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#a52bec8579465e01bf4ed1ed9667c69bb">pcl::NNClassification::setTrainingFeatures</a></div><div class="ttdeci">void setTrainingFeatures(const typename pcl::PointCloud&lt; PointT &gt;::ConstPtr &amp;features)</div><div class="ttdoc">Setting the training features.</div><div class="ttdef"><b>Definition:</b> nn_classification.h:84</div></div>
<div class="ttc" id="aclasspcl_1_1_point_cloud_html"><div class="ttname"><a href="classpcl_1_1_point_cloud.html">pcl::PointCloud</a></div><div class="ttdoc">PointCloud represents the base class in PCL for storing collections of 3D points.</div><div class="ttdef"><b>Definition:</b> point_cloud.h:173</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="a7c8be2d8883ec49769ac31e5756ef701"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7c8be2d8883ec49769ac31e5756ef701">&#9670;&nbsp;</a></span>saveTrainingFeatures()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename PointT &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool <a class="el" href="classpcl_1_1_n_n_classification.html">pcl::NNClassification</a>&lt; <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &gt;::saveTrainingFeatures </td>
          <td>(</td>
          <td class="paramtype">std::string&#160;</td>
          <td class="paramname"><em>file_name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::string&#160;</td>
          <td class="paramname"><em>labels_file_name</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Save the list of training examples and corresponding labels. </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">file_name</td><td>file name for writing the training features </td></tr>
    <tr><td class="paramname">labels_file_name</td><td>file name for writing the class label for each training example </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>true on success, false on failure (write error or number of entries don't match) </dd></dl>
<div class="fragment"><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;      {</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;        <span class="keyword">typename</span> pcl::PointCloud&lt;PointT&gt;::ConstPtr training_features = tree_-&gt;getInputCloud ();</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;        <span class="keywordflow">if</span> (<a class="code" href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">labels_idx_</a>.size () == training_features-&gt;<a class="code" href="classpcl_1_1_point_cloud.html#af16a62638198313b9c093127c492c884">points</a>.size ())</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;        {</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;          <span class="keywordflow">if</span> (pcl::io::savePCDFile (file_name.c_str (), *training_features) != 0)</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;            <span class="keywordflow">return</span> (<span class="keyword">false</span>);</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;          std::ofstream f (labels_file_name.c_str ());</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;          BOOST_FOREACH (<span class="keywordtype">int</span> i, <a class="code" href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">labels_idx_</a>)</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;            f &lt;&lt; <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>[i] &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;          <span class="keywordflow">return</span> (<span class="keyword">true</span>);</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;        }</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;        <span class="keywordflow">return</span> (<span class="keyword">false</span>);</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;      }</div>
<div class="ttc" id="aclasspcl_1_1_point_cloud_html_af16a62638198313b9c093127c492c884"><div class="ttname"><a href="classpcl_1_1_point_cloud.html#af16a62638198313b9c093127c492c884">pcl::PointCloud::points</a></div><div class="ttdeci">std::vector&lt; PointT, Eigen::aligned_allocator&lt; PointT &gt; &gt; points</div><div class="ttdoc">The point data.</div><div class="ttdef"><b>Definition:</b> point_cloud.h:410</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="a52bec8579465e01bf4ed1ed9667c69bb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a52bec8579465e01bf4ed1ed9667c69bb">&#9670;&nbsp;</a></span>setTrainingFeatures()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename PointT &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classpcl_1_1_n_n_classification.html">pcl::NNClassification</a>&lt; <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &gt;::setTrainingFeatures </td>
          <td>(</td>
          <td class="paramtype">const typename <a class="el" href="classpcl_1_1_point_cloud.html">pcl::PointCloud</a>&lt; <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &gt;::ConstPtr &amp;&#160;</td>
          <td class="paramname"><em>features</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Setting the training features. </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">features</td><td>the training features </td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;      {</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;        <span class="comment">// Do not limit the number of dimensions used in the tree</span></div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;        <span class="keyword">typename</span> pcl::CustomPointRepresentation&lt;PointT&gt;::Ptr cpr (<span class="keyword">new</span> <a class="code" href="classpcl_1_1_custom_point_representation.html">pcl::CustomPointRepresentation&lt;PointT&gt;</a> (INT_MAX, 0));</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;        tree_.reset (<span class="keyword">new</span> <a class="code" href="classpcl_1_1_kd_tree_f_l_a_n_n.html">pcl::KdTreeFLANN&lt;PointT&gt;</a>);</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;        tree_-&gt;setPointRepresentation (cpr);</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;        tree_-&gt;setInputCloud (features);</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;      }</div>
<div class="ttc" id="aclasspcl_1_1_custom_point_representation_html"><div class="ttname"><a href="classpcl_1_1_custom_point_representation.html">pcl::CustomPointRepresentation</a></div><div class="ttdoc">CustomPointRepresentation extends PointRepresentation to allow for sub-part selection on the point.</div><div class="ttdef"><b>Definition:</b> point_representation.h:518</div></div>
<div class="ttc" id="aclasspcl_1_1_kd_tree_f_l_a_n_n_html"><div class="ttname"><a href="classpcl_1_1_kd_tree_f_l_a_n_n.html">pcl::KdTreeFLANN</a></div><div class="ttdoc">KdTreeFLANN is a generic type of 3D spatial locator using kD-tree structures. The class is making use...</div><div class="ttdef"><b>Definition:</b> kdtree_flann.h:70</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="a7c06ebf50123854d0a4712654a944f23"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7c06ebf50123854d0a4712654a944f23">&#9670;&nbsp;</a></span>setTrainingLabelIndicesAndLUT()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename PointT &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classpcl_1_1_n_n_classification.html">pcl::NNClassification</a>&lt; <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &gt;::setTrainingLabelIndicesAndLUT </td>
          <td>(</td>
          <td class="paramtype">const std::vector&lt; std::string &gt; &amp;&#160;</td>
          <td class="paramname"><em>classes</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::vector&lt; int &gt; &amp;&#160;</td>
          <td class="paramname"><em>labels_idx</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Updating the labels for each training example. </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">classes</td><td>the class labels </td></tr>
    <tr><td class="paramname">labels_idx</td><td>the index in the class labels list for each training example </td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;      {</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;        <span class="comment">// TODO check if min/max index is inside classes?</span></div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;        <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a> = classes;</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;        <a class="code" href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">labels_idx_</a> = labels_idx;</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;      }</div>
</div><!-- fragment -->
</div>
</div>
<a id="a240a675d7ba75bbc77482ed7accc7ce0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a240a675d7ba75bbc77482ed7accc7ce0">&#9670;&nbsp;</a></span>setTrainingLabels()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename PointT &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classpcl_1_1_n_n_classification.html">pcl::NNClassification</a>&lt; <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &gt;::setTrainingLabels </td>
          <td>(</td>
          <td class="paramtype">const std::vector&lt; std::string &gt; &amp;&#160;</td>
          <td class="paramname"><em>labels</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Setting the labels for each training example. The unique labels from the list are stored as the class labels, and for each training example an index pointing to these labels is stored. </p>
<dl class="section note"><dt>注解</dt><dd>See the setTrainingLabelIndicesAndLUT method for easily re-labeling. </dd></dl>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">labels</td><td>the class label for each training example </td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;      {</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;        <span class="comment">// Create a list of unique labels</span></div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;        <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a> = labels;</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;        std::sort (<a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.begin(), <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.end());</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;        <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.erase (std::unique (<a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.begin(), <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.end()), <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.end());</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160; </div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;        <span class="comment">// Save the mapping from labels to indices in the class list</span></div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;        std::map&lt;std::string, int&gt; label2idx;</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;        <span class="keywordflow">for</span> (std::vector&lt;std::string&gt;::const_iterator it = <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.begin (); it != <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.end (); it++)</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;          label2idx[*it] = int (it - <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.begin ());</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160; </div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;        <span class="comment">// Create a list holding the class index of each label</span></div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;        <a class="code" href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">labels_idx_</a>.reserve (labels.size ());</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;        BOOST_FOREACH (std::string s, labels)</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;          <a class="code" href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">labels_idx_</a>.push_back (label2idx[s]);</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;<span class="comment">//        for (std::vector&lt;std::string&gt;::const_iterator it = labels.begin (); it != labels.end (); it++)</span></div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;<span class="comment">//          labels_idx_.push_back (label2idx[*it]);</span></div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;      }</div>
</div><!-- fragment -->
</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>apps/include/pcl/apps/<a class="el" href="nn__classification_8h_source.html">nn_classification.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><b>pcl</b></li><li class="navelem"><a class="el" href="classpcl_1_1_n_n_classification.html">NNClassification</a></li>
    <li class="footer">制作者 <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
